import 'package:flutter/material.dart';

class UiRadialGradientMask extends StatelessWidget {
  const UiRadialGradientMask({
    super.key,
    required this.child,
    this.gradient = true,
    this.colors,
    this.stops,
    this.center = Alignment.center,
    this.radius = 0.5,
    this.tileMode = TileMode.mirror,
  });
  final Widget child;
  final bool gradient;
  final List<Color>? colors;
  final List<double>? stops;
  final AlignmentGeometry center;
  final double radius;
  final TileMode tileMode;

  @override
  Widget build(BuildContext context) {
    return gradient
        ? ShaderMask(
            shaderCallback: (bounds) {
              return RadialGradient(
                center: center,
                radius: radius,
                colors: colors ??
                    const [
                      Color.fromARGB(255, 11, 232, 248),
                      Color.fromARGB(255, 33, 51, 243),
                    ],
                stops: stops ?? const [0, 1],
                tileMode: tileMode,
              ).createShader(bounds);
            },
            child: child,
          )
        : child;
  }
}
